<!DOCTYPE html>
<html><head>
 <meta charset="utf-8">
 <title>{$title}</title>
 <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
 <meta name="apple-mobile-web-app-capable" content="yes">
 <meta name="apple-mobile-web-app-status-bar-style" content="black">

<link rel="stylesheet" href="css/mui.min.css">
 <style type="text/css">
 #list {
 /*避免导航边框和列表背景边框重叠，看起来像两条边框似得；*/
 margin-top: -1px;
 }
 .mui-bar .mui-pull-left .mui-icon {
 padding-right: 5px;
 font-size: 28px;
 }
 .mui-bar .mui-btn {
 font-weight: normal;
 font-size: 17px;
 }
 .mui-bar .mui-btn-link {
 top: 1px;
 }
 .mui-scroll { height: 28px; line-height: 28px; overflow: hidden;}
 .mui-scroll a{padding: 5px;}
 .red{
 color:#FF0000;
}
 .no{ background-color:#FFFFFF}
 .mui-content-padded {
 margin-top: 25px;
 }
 .hy-box{background-color:#FFFFFF; padding:10px;}
 .mui-input-row{margin:5px; padding:5px;}
 .green{color:#00FF00}
 .mui-table-view-chevron .mui-table-view-cell{padding-right:65px}
 </style>
 </head>

 <body>
<header id="header" class="mui-bar mui-bar-nav">
 <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
 <h1 class="mui-title" id="mui-title">金币收支</h1>
</header>
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="hy-box">
<div class="mui-table-view-cell">用户名
  <span class="mui-badge mui-badge-primary" id="usertext"></span>
 </div>
<div class="mui-table-view-cell">金币
  <span class="mui-badge mui-badge-primary" id="gold"></span>
 </div>
<ul class="pullrefresh-view mui-table-view mui-table-view-chevron" id="mui-table-view"></ul>
 </div>
</div>
<div id="logindiv" class="mui-popover mui-popover-bottom mui-popover-action">
<div class="hy-box" style="font-size: 16px;">
<form class="mui-input-group" action="/ap.php">
<div class="mui-input-row"><label>账号</label><input id='user' type="text" class="mui-input" placeholder="请输入账号"></div>
<div class="mui-input-row"><label>密码</label><input id='pass1' type="password" class="mui-input" placeholder="请输入密码"></div>
<div class="mui-input-row" id="pass2d"><label>重复密码</label><input id='pass2' type="password" class="mui-input" placeholder="请再次输入密码"></div> 
<div class="mui-input-row" id="emaild"><label>邮箱</label><input id='email' type="text" class="mui-input" placeholder="请输入您的邮箱"></div> 
</form> 
<div class="mui-content-padded"><button id='loginb' class="mui-btn mui-btn-block mui-btn-primary">登录</button><a id='add'>注册账号</a></div>

</div>
</div> 
</div>
<script src="js/mui.min.js"></script>
<script src="config.js"></script> 
<script>
var loginButton = document.getElementById('loginb');
var regid='login';
var islogin=false;
var pagtime=0;
var ajaxbool=false;
 function regdiv(){
 if(regid=='login'){
document.getElementById("emaild").style.display="none";
document.getElementById("pass2d").style.display="none";
 }else if(regid=='add'){
 document.getElementById("emaild").style.display="inline";
document.getElementById("pass2d").style.display="inline";
 }
 
 }
function setdata(data){
if(typeof(data['hex'])!="undefined"){ 
 ysv8hex=data['hex'];
 localStorage.setItem("ysv8hex",data['hex']);
 }
if(data['error']){
islogin=true;
document.getElementById('usertext').innerText=data['my']['user'];
document.getElementById('gold').innerText=data['my']['gold'];
}else{
if(data['info']){
mui.alert(data['info']);
}
islogin=false;
document.getElementById('mui-title').innerText="请登录";
document.getElementById('gold').innerText="请登录";
 var gethtml=regdiv();
 mui('#logindiv').popover('toggle');
}

}

function getmx(){
 mui.post('https://www.ysv8.com/open/user',{type:'mx',pageid:pagtime,YSV8_HEX:ysv8hex},function(data2){
 setdata(data2);
  ajaxbool=true;
 
 
 var data=data2['mx'];
  var table = document.body.querySelector('.pullrefresh-view');
 var loadi=0; 
 if(data.length==0){
 var li = document.createElement('li');
  li.className = 'mui-table-view-cell red';
  li.innerHTML = '没有记录';
  table.appendChild(li);
 return false;
 }
 for (i = 0;i < data.length; i++) {
 loadi++; 
 data[i]['id']=Number( data[i]['id']);
 if(pagtime>data[i]['id'] || pagtime==0){pagtime=data[i]['id']}
 var li = document.createElement('li'); 
switch (data[i]['size']){
case '1':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="t.html?id='+data[i]['linkid']+'">群收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break;
case '2':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="t.html?id='+data[i]['linkid']+'">悬赏支出<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;
case '3':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="t.html?id='+data[i]['linkid']+'">回复押金<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;
case '4':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="wt.html?id='+data[i]['linkid']+'">回复押金<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;
case '5':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="https://www.ysv8.com/f/'+data[i]['linkid']+'.html">关注金<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;
case '6':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="https://www.ysv8.com/f/'+data[i]['linkid']+'.html">群收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break;
case '7':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="https://www.ysv8.com/a/'+data[i]['linkid']+'.html">下载支出<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;
 case '8':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="https://www.ysv8.com/a/'+data[i]['linkid']+'.html">附件收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break; 
 case '9':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="cz.html">充值<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break; 
 case '10':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="my.html">提现<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break; 
 case '11':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="index.html">评论收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break; 
 case '12':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="index.html">评论收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break; 
 case '13':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="t.html?id='+data[i]['linkid']+'">主题收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span><a>';
 break; 
 case '14':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="wt.html?id='+data[i]['linkid']+'">微博收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span><a>';
 break; 
 case '15':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="https://www.ysv8.com/open">推广收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span><a>';
 break;
 case '16':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="wt.html?id='+data[i]['linkid']+'">下载支出<span class="mui-badge mui-badge-success">'+data[i]['gold']+'</span></a>';
 break;

case '17':
li.className = 'mui-table-view-cell';
li.innerHTML = '<a hre="wt.html?id='+data[i]['linkid']+'">下载收入<span class="mui-badge mui-badge-danger">'+data[i]['gold']+'</span></a>';
 break;

 
}
 
  table.appendChild(li); 
  }
 

 mui.toast('成功加载'+loadi+'条记录',{ duration:'short', type:'div' });
if(loadi<10){
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); 
var li = document.createElement('li');
      li.className = 'mui-table-view-cell mui-media';
      li.innerHTML = '<p style="text-align:center">全部加载完毕</p>';
      table.appendChild(li);
}else{
mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); 
 }
 ajaxbool=false
 
 
 
 
 
 });
} 
mui.init({
    pullRefresh: {
     container: '#pullrefresh',
     up: {
      callback: getmx
     }
    }
   });
 (function($) {
$.ready(function() {
setTimeout(function() {getmx();}, 500);
});
})(mui);
 mui(".pullrefresh-view").on('tap','a',function(){
 id = this.getAttribute("hre");
 mui.openWindow({
 url: id, 
 id:'mxid'
 });
});
mui(".mui-reglogin").on('tap','a',function(){
id = this.getAttribute("id");
if(id=="regandlog"){
var gethtml=regdiv();
 mui('#logindiv').popover('toggle');
 }
 
 if(id=="out"){
mui.post('https://www.ysv8.com/open/user',{type:'out',YSV8_HEX:ysv8hex},function(data){
 setdata(data);
 ysv8hex='no';
 localStorage.setItem("ysv8hex",'no');
 
 });
 }
 
});
 
mui(".mui-content-padded").on('tap','a',function(){
id = this.getAttribute("id");
var idinner=this.innerText;
this.id=regid;
regid=id;
var gethtml=regdiv();
this.innerText=loginButton.innerText;
loginButton.innerText=idinner;
}); 


mui(".mui-content-padded").on('tap','button',function(){
 mui.post('https://www.ysv8.com/open/user',{user:document.getElementById("user").value,pass1:document.getElementById("pass1").value,pass2:document.getElementById("pass2").value,email:document.getElementById("email").value,type:regid},function(data){
 setdata(data);
 mui('#logindiv').popover('toggle');
 });


}); 
 mui(".mui-bar-tab").on('tap','.mui-tab-item',function(){
id = this.getAttribute("her");
if(id){
mui.openWindow({
url: id, 
id:id
});
}
}); 
 mui(".mui-row").on('tap','a',function(){
id = this.getAttribute("her");
mui.openWindow({
url: id, 
id:'nav'
});
}); 

 </script>
 </body>

</html>
